package cn.flying.cloud.base.common.utils.local;

import java.util.Objects;

import cn.flying.cloud.base.common.constants.Constants;
import cn.flying.cloud.base.common.utils.Ft;

/**
 * @author: admin
 * @date: 2025年02月28日 13:08
 * @version: 1.0
 */
public class LocalUtil {

    public static String TenantId() {
        Object o = Ft.ThreadLocal.get(Constants.TENANT_ID);
        return Objects.isNull(o) ? "" : (String) o;
    }

    public static void TenantId(String val) {
        Ft.ThreadLocal.set(Constants.TENANT_ID, val);
    }

    public static String UserName() {
        Object o = Ft.ThreadLocal.get(Constants.USER_NAME);
        return Objects.isNull(o) ? "" : (String) o;
    }

    public static void UserName(String val) {
        Ft.ThreadLocal.set(Constants.USER_NAME, val);
    }

    public static String UserId() {
        Object o = Ft.ThreadLocal.get(Constants.USER_ID);
        return Objects.isNull(o) ? "" : (String) o;
    }

    public static void UserId(String val) {
        Ft.ThreadLocal.set(Constants.USER_ID, val);
    }

    public static String FullName() {
        Object o = Ft.ThreadLocal.get(Constants.FULL_NAME);
        return Objects.isNull(o) ? "" : (String) o;
    }

    public static void FullName(String val) {
        Ft.ThreadLocal.set(Constants.FULL_NAME, val);
    }

    public static String RequestId() {
        Object o = Ft.ThreadLocal.get(Constants.REQUEST_ID);
        return Objects.isNull(o) ? "" : (String) o;
    }

    public static void RequestId(String val) {
        Ft.ThreadLocal.set(Constants.REQUEST_ID, val);
    }

    public static String EnvId() {
        Object o = Ft.ThreadLocal.get(Constants.ENV_ID);
        return Objects.isNull(o) ? "" : (String) o;
    }

    public static void EnvId(String val) {
        Ft.ThreadLocal.set(Constants.ENV_ID, val);
    }
}
